from django.contrib.auth.models import User
from django.db import models

from shopping.models import Commodity
from utils.modelsMixin import ModelSetMixin


class Cart(ModelSetMixin):
    number = models.IntegerField(default=1,verbose_name='数量')
    commodity = models.ForeignKey(Commodity,on_delete=models.CASCADE,verbose_name='商品名')
    user = models.ForeignKey(User,on_delete=models.CASCADE,verbose_name='用户名')

    class Meta:
        ordering = ['-update_time']
        db_table = 'cart'
        verbose_name = '购物车'
        verbose_name_plural = verbose_name
    def __str__(self):
        return f'%s.%s' %(self.id,self.commodity)









# Create your models here.
